Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new test demonstrating endless loop with incorrect G71 parameters #1869

Merged

Conversation

petterreinholdtsen
Copy link
Collaborator

@petterreinholdtsen petterreinholdtsen commented Jul 26, 2022

I found this issue in issue #1146. This example g-code program causes
the AXIS LinuxCNC GUI to get completely stuck while its memory use explode.
I decided to write a small test case to demonstrate the problem.
Discovered that the program cause the rs274 program to generate an
endless stream of repeated instructions, which I suspect is the cause of
the memory explosion.

@petterreinholdtsen
Copy link
Collaborator Author

For the record, this is a gdb backtrace from the endless look, after breaking in fprintf:

#0  0x00005555555be851 in fprintf (__fmt=<optimized out>, 
    __stream=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:100
#1  STRAIGHT_FEED (line_number=-1, x=3.064721359549996, y=0, 
    z=-14.039999999999999, a=0, b=0, c=0, u=0, v=0, w=0)
    at emc/sai/saicanon.cc:379
#2  0x00007ffff7e8725c in Interp::convert_straight (this=0x7ffff7f7f010, 
    move=move@entry=10, block=0x7ffff7f801b0, settings=0x7ffff7f80020)
    at emc/rs274ngc/interp_convert.cc:4781
#3  0x00007ffff7eb4f55 in motion_machine::straight_move (this=<optimized out>, 
    end=...) at emc/rs274ngc/interp_g7x.cc:952
#4  0x00007ffff7eb1e1f in straight_segment::dive (this=<optimized out>, 
    location=..., x=-3.064721359549996, output=0x55555571c7b0, 
    fast=<optimized out>) at emc/rs274ngc/interp_g7x.cc:212
#5  0x00007ffff7eb1fb2 in g7x::pocket (this=0x7fffffffd460, cycle=3, 
    location=..., p=..., out=0x55555571c7b0) at emc/rs274ngc/interp_g7x.cc:767
#6  0x00007ffff7eb73f8 in g7x::do_g71 (this=this@entry=0x7fffffffd460, 
    out=<optimized out>, cycle=cycle@entry=2, x=x@entry=15, z=z@entry=0, u=0, 
    w=<optimized out>, d=0.040000000000000001, i=0.5, r=1, 
    do_rotate=<optimized out>) at emc/rs274ngc/interp_g7x.cc:84
#7  0x00007ffff7eb3e5f in g7x::do_g72 (r=<optimized out>, i=<optimized out>, 
    d=<optimized out>, w=<optimized out>, u=<optimized out>, z=<optimized out>, 
    x=<optimized out>, cycle=<optimized out>, out=<optimized out>, 
    this=<optimized out>) at emc/rs274ngc/interp_g7x.cc:745
#8  Interp::convert_g7x (this=this@entry=0x7ffff7f7f010, mode=mode@entry=712, 
    block=block@entry=0x7ffff7f801b0, settings=settings@entry=0x7ffff7f80020)
    at emc/rs274ngc/interp_g7x.cc:1195
#9  0x00007ffff7e8aa60 in Interp::convert_motion (
    this=this@entry=0x7ffff7f7f010, motion=<optimized out>, 
    block=block@entry=0x7ffff7f801b0, settings=settings@entry=0x7ffff7f80020)
    at emc/rs274ngc/interp_convert.cc:3757
#10 0x00007ffff7e8b0dc in Interp::convert_g (this=this@entry=0x7ffff7f7f010, 
    block=block@entry=0x7ffff7f801b0, settings=settings@entry=0x7ffff7f80020)
    at emc/rs274ngc/interp_convert.cc:2358
#11 0x00007ffff7e9c56c in Interp::execute_block (
    this=this@entry=0x7ffff7f7f010, block=block@entry=0x7ffff7f801b0, 
    settings=settings@entry=0x7ffff7f80020)
    at emc/rs274ngc/interp_execute.cc:304
#12 0x00007ffff7f10aaf in Interp::_execute (this=this@entry=0x7ffff7f7f010, 
    command=<optimized out>) at emc/rs274ngc/rs274ngc_pre.cc:504
#13 0x00007ffff7f10e8f in Interp::execute (this=0x7ffff7f7f010, 
    command=<optimized out>) at emc/rs274ngc/rs274ngc_pre.cc:533
#14 0x00005555555c171b in interpret_from_file (do_next=2, 
    block_delete=block_delete@entry=0, print_stack=0) at emc/sai/driver.cc:287
#15 0x00005555555bcb09 in main (argc=<optimized out>, argv=0x7fffffffdf60)

I found this in issue LinuxCNC#1146. This example g-code program causes
the AXIS LinuxCNC GUI to get completely stuck while its memory use explode.
I decided to write a small test case to demonstrate the problem.
Discovered that the program cause the rs274 program to generate an
endless stream of repeated instructions, which I suspect is the cause of
the memory explosion.

Flaggex xfail as it is expected to fail until the bug is found and
fixed.
@petterreinholdtsen petterreinholdtsen merged commit 4b8b215 into LinuxCNC:master Aug 9, 2022
@petterreinholdtsen petterreinholdtsen deleted the test-g71-endless-loop branch August 10, 2022 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant